/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package huffman;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 *
 * @author Jose Carlos Palma
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        
        int b = 0;
        int pos = 0;
        
        b |= ( 1 << pos++ );
        b |= ( 0 << pos++ );
        b |= ( 1 << pos++ );
        b |= ( 1 << pos++ );
        b |= ( 1 << pos++ );
        b |= ( 0 << pos++ );
        
        System.out.println(Integer.toBinaryString(b));
        
        /*
        FileOutputStream fos = new FileOutputStream("out.bin");
        fos.write(b);
        fos.flush();
        fos.close();
        */
        
        FileInputStream fis = new FileInputStream("out.bin");
        
        BitInputStream bis = new BitInputStream(fis);
        
        System.out.println( bis.readBit() );
        System.out.println( bis.readBit() );
        System.out.println( bis.readBit() );
        System.out.println( bis.readBit() );
        System.out.println( bis.readBit() );
        System.out.println( bis.readBit() );
        System.out.println( bis.readBit() );
        
        
    }
}
